Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala 2.12 upgrade preview with mysql tests fixed #346

Merged
merged 8 commits into from
May 10, 2017
Merged

Conversation

pankajroark
Copy link
Contributor

Builds on top of #342 fixing the mysql tests that the scalacheck upgrade breaks.

Ben McNiel and others added 2 commits April 14, 2017 00:32
1. Incremented all required versions to value that included scala 2.12 support. See diff for details.
2. Modified RedisStore to use Buf instead of ChannelBuffer due to changes in underlying client. To ease this
   transition a method to convert Store[Buf, Buf] to Store[ChannelBuffer, ChannelBuffer]
   is provided on RedisStore.
3. Removed support for Scala 2.10. Two libraries lacked support for scala 2.10 and 2.12 on the same version: twiiter-util and finagle.
   Supporting 2.10 finagle and 2.12 finagle was not possible due to interface changes.
4. Various packages changed and were fixed.
5. Added target to travis.yml and build.sbt to include scala 2.12.
6. Set source and build target to java 8 to support scala 2.12.
@pankajroark
Copy link
Contributor Author

All tests have passed afaict, looks like travis is having issues.

@pankajroark pankajroark requested review from johnynek and ttim May 8, 2017 18:03
Copy link
Collaborator

@ttim ttim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, the only questionable thing for me - should we enable 2.12 as part of this change?

.travis.yml Outdated
- scala: 2.11.8
jdk: oraclejdk8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do this for 2.11?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I guess in the original PR Ben may have added it for consistency. Let me remove it.

build.sbt Outdated
crossScalaVersions := Seq("2.10.6", "2.11.7"),
javacOptions ++= Seq("-source", "1.6", "-target", "1.6"),
javacOptions in doc := Seq("-source", "1.6"),
crossScalaVersions := Seq("2.11.7", "2.12.1"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add 2.12 here then should we also enable travis for 2.12?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use 2.11.11 and 2.12.2?

@@ -19,7 +19,8 @@ package com.twitter.storehaus.algebra.query
import org.scalacheck.{ Gen, Arbitrary }
import org.scalacheck.Prop._
import org.scalacheck.Properties
import com.twitter.scalding._
import com.twitter.scalding.{RichDate, DateRange, Duration, AbsoluteDuration, Years,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need it in this review?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to minimize. I prefer to keep the diffs as minimal as possible (and personally never mix style and logic changes if possible).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

.travis.yml Outdated
script: umask 0022 && ./sbt ++$TRAVIS_SCALA_VERSION clean coverage test coverageReport mimaReportBinaryIssues
after_success:
- bash <(curl -s https://codecov.io/bash)
# - scala: 2.12.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the story here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh... this got carried over from Ben's original PR. Let me uncomment this.

build.sbt Outdated
crossScalaVersions := Seq("2.10.6", "2.11.7"),
javacOptions ++= Seq("-source", "1.6", "-target", "1.6"),
javacOptions in doc := Seq("-source", "1.6"),
crossScalaVersions := Seq("2.11.7", "2.12.1"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use 2.11.11 and 2.12.2?

@@ -19,7 +19,8 @@ package com.twitter.storehaus.algebra.query
import org.scalacheck.{ Gen, Arbitrary }
import org.scalacheck.Prop._
import org.scalacheck.Properties
import com.twitter.scalding._
import com.twitter.scalding.{RichDate, DateRange, Duration, AbsoluteDuration, Years,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to minimize. I prefer to keep the diffs as minimal as possible (and personally never mix style and logic changes if possible).

@@ -70,7 +70,6 @@ object MemcacheStore {
.tcpConnectTimeout(timeout)
.requestTimeout(timeout)
.connectTimeout(timeout)
.readerIdleTimeout(timeout)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems like a maybe logical change. Are we sure there is nothing to replace it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied the alternative way of doing this.

kv match {
case (k, Some(v)) =>
client.del(Seq(k)) // put, not merge, semantics
ttl.map(exp => client.expire(k, exp.inSeconds))
client.dels(Seq(k)) // put, not merge, semantics
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to wrap with a Seq. Could we just call client.del(k) maybe? Also, this seems like a a race to me. the del could happen after the set. We should use flatMap to sequence:

for {
  _ <- client.del(k)
  _ <- ttl.fold(Future.Unit) { exp => client.expire(k, exp.inSeconds) }
  _ <- set(k, v.toList)
} yield ()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

del is deprecated unfortunately. Taken care of the race.

set(k, v.toList)
case (k, None) =>
client.del(Seq(k)).unit
client.dels(Seq(k)).unit
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there noclient.del(k) we can call?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

del is deprecated:
@deprecated("remove netty3 types from public API", "2016-03-24")
def del(keys: Seq[ChannelBuffer]): Future[JLong] =

override def get(k: ChannelBuffer): Future[Option[Seq[(ChannelBuffer, Double)]]] =
client.zRange(k, 0, -1, true).map(
override def get(k: Buf): Future[Option[Seq[(Buf, Double)]]] =
client.zRange(k, 0.toLong, -1.toLong, true).map(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0L and -1L is the better way to do this.

kv match {
case (set, Some(scorings)) =>
client.del(Seq(set)).flatMap { _ =>
client.dels(Seq(set)).flatMap { _ =>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there no client.del(set)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is but it's marked deprecated.

Future.collect(members.multiPut(scorings.map {
case (member, score) => ((set, member), Some(score))
}.toMap).values.toSeq).unit
}
case (set, None) =>
client.del(Seq(set)).unit
client.dels(Seq(set)).unit
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment about client.del(set).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

del is deprecated.

}
}

object ChannelBuffer2BufInjection extends Injection[ChannelBuffer, Buf] {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be a bijection, not an Injection (there is an implicit from Bijection to Injection, by the way so you can pass this as the injection above).

finagle-http-compat has been removed in more recent versions, taking
care of that may need non-trivial changes. Will
upgrade finagle version in a follow up change.
…, again due to property declaration behavior change in scalacheck. Fix that.
@codecov-io
Copy link

codecov-io commented May 9, 2017

Codecov Report

Merging #346 into develop will decrease coverage by 0.14%.
The diff coverage is 23.8%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #346      +/-   ##
===========================================
- Coverage    61.48%   61.33%   -0.15%     
===========================================
  Files          119      119              
  Lines         1807     1813       +6     
  Branches       118      117       -1     
===========================================
+ Hits          1111     1112       +1     
- Misses         696      701       +5
Impacted Files Coverage Δ
...scala/com/twitter/storehaus/mysql/MySqlStore.scala 96.84% <ø> (ø) ⬆️
...cala/com/twitter/storehaus/mysql/ValueMapper.scala 54.76% <ø> (ø) ⬆️
...a/com/twitter/storehaus/mysql/MySqlLongStore.scala 50% <ø> (ø) ⬆️
...la/com/twitter/storehaus/redis/RedisSetStore.scala 0% <0%> (ø) ⬆️
...a/com/twitter/storehaus/redis/RedisHashStore.scala 0% <0%> (ø) ⬆️
...com/twitter/storehaus/memcache/MemcacheStore.scala 39.28% <0%> (-3.03%) ⬇️
...a/com/twitter/storehaus/redis/RedisLongStore.scala 75% <100%> (ø) ⬆️
...scala/com/twitter/storehaus/redis/RedisStore.scala 33.33% <20%> (-5.56%) ⬇️
.../twitter/storehaus/redis/RedisSortedSetStore.scala 73.8% <75%> (ø) ⬆️
.../twitter/storehaus/mysql/MergeableMySqlStore.scala 91.3% <0%> (+4.34%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b02d72c...67728c4. Read the comment docs.

@oscar-stripe
Copy link

+1

After we publish a new version, we should bump the minor version, and remove all the exclusions for mima.

Thanks for doing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants